import request from '@/utils/request'

export function getSimpleEmployees() {
  return request({
    method: 'get',
    url: '/sys/user/simple'
  })
}

export function getEmployees(params) {
  return request({
    method: 'get',
    url: '/sys/user',
    params
  })
}

/**
 * @description: 删除员工
 * @param {*} id 员工id
 * @return {*}
 */
export function delEmployee(id) {
  return request({
    method: 'delete',
    url: '/sys/user/${id}'
  })
}

export function addEmployee(data) {
  return request({
    method: 'post',
    url: '/sys/user',
    data
  })
}

export function importEmployees(data) {
  return request({
    method: 'post',
    url: '/sys/user/batch',
    data
  })
}

export function updateEmployee(data) {
  return request({
    method: 'put',
    url: '/sys/user/' + data.id,
    data
  })
}

// data: { id: 用户 id, roleIds: [角色 id1, ...] }
export function assignRoles(data) {
  return request({
    method: 'put',
    url: '/sys/user/assignRoles',
    data
  })
}
